import 'package:bruno/bruno.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';

import '../main/home_page/logic.dart';

/// 自定义首页搜索框
class RadiusSearchBorder extends StatelessWidget {
  final state = Get.find<HomeLogic>().state;

  RadiusSearchBorder({
    super.key,
    required this.radius,
    required this.borderColor,
    required this.searchWidth,
    required this.searchHeight,
    this.onTap,
  });

  final double radius;

  final Color borderColor;

  /// 点击的回调
  final VoidCallback? onTap;

  final double searchWidth ;

  final double searchHeight;

  @override
  Widget build(BuildContext context) {
    return Container(
        margin:
            EdgeInsets.only(left: 20.w, top: ScreenUtil().statusBarHeight + 10),
        height: searchHeight,
        width: searchWidth,
        //边框设置
        decoration: BoxDecoration(
          //背景
          color: borderColor,
          //设置四周圆角 角度
          borderRadius: BorderRadius.all(Radius.circular(radius)),
          //设置四周边框
          border: Border.all(width: 1, color: borderColor),
        ),
        child: Padding(
            padding: const EdgeInsets.only(left: 10),
            child: BrnIconButton(
              name: "输入楼盘名称/街道号/房源编号/业主手机号",
              onTap: onTap,
              iconWidget: Image.asset(
                state.searchIcon, color: Colors.black26
              ),
              iconWidth: 18,
              iconHeight: 24,
              direction: Direction.left,
              widgetWidth: 0.75.sw,
              style: const TextStyle(fontSize: 12, color: Colors.grey),
              mainAxisAlignment: MainAxisAlignment.start,
            )));
  }
}
